package chapter3.No3_1_等待和通知机制.l通过管道进行线程间通信_字符流;

import java.io.IOException;
import java.io.PipedReader;

/**
 * Created by Administrator on 2016/11/20.
 */
public class ReadData {

    public void readMethod(PipedReader pr) {
        try {
            char[] readBuffer = new char[10];
            int readLength = pr.read(readBuffer);
            System.out.println("读取：");
            while(readLength != -1) {
                String readValue = new String(readBuffer, 0, readLength);
                System.out.print(readValue);
                readLength = pr.read(readBuffer);
            }
            System.out.println();
            pr.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
